﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace OffLineFilter
{
    class ShinglesComparer
    {
        public static double Compare(uint[] first, uint[] second)
        {
            int maxLength = Math.Max(first.Length, second.Length);
            int minLength = Math.Min(first.Length, second.Length);

            int matches = 0;
            for (int i = 0; i < minLength; i++)
            {
                if (second.Any(element => element == first[i]))
                    matches++;
            }

            return (double)matches / (double)maxLength;
        }
    }
}
